package org.ekstrabilet.stadium;

import java.awt.Color;
import java.awt.Graphics;

import org.ekstrabilet.stadium.beans.Sector;
import org.ekstrabilet.stadium.beans.Stadium;
import org.ekstrabilet.stadium.beans.Tribune;
import org.ekstrabilet.stadium.constants.StadiumConstants;
/**
 * 
 * @author Maciej Koch
 *	Class responsible for drawing tribunes segmented
 */
public class View {
	
	/**
	 * Renders tribunes and sectors
	 * @param g
	 * @param stadium
	 */
	public void renderTribunes(Graphics g, Stadium stadium) {	
		//tribunes
		for(Tribune t : stadium.getTribunes()) {
			//sectors
			g.setColor(Color.red);
			for(Sector s : t.getSectors()) {
				g.drawRect((int)s.x,(int)s.y, (int)s.width,(int) s.height);
			}		
		}
	}
	/**
	 * Renders signs of sectors;
	 * @param g
	 * @param stadium
	 */
	public void renderSigns(Graphics g, Stadium stadium) {	
		//signs
		for(Tribune t : stadium.getTribunes()) {
			for(Sector s : t.getSectors()) {
				g.setColor(Color.white);
				g.drawString(s.getSign()+"", (int)s.x + (int)s.width/2, (int)s.y + (int)s.height/2);
			}	
		}
	}
}
